<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>低价租赁</title>
    <link rel="stylesheet" href="<%=basePath%>css/common_new.min.css">
    <link rel="stylesheet" href="<%=basePath%>static/css/owl.carousel.min.css">
    <link rel="stylesheet" href="<%=basePath%>css/zupin02.css">
    <script src="<%=basePath%>static/js/jquery.min.js"></script>
    <script src="<%=basePath%>js/zupin02.js"></script>
    
    <script rel="script" src="<%=basePath%>js/vue.min.js"></script>
	<link rel="stylesheet"
		href="//at.alicdn.com/t/font_699355_5fafq7zsd2fq1tt9.css">
	<link rel="stylesheet" href="<%=basePath%>css/index.css">
	<script type="text/javascript" src="<%=basePath%>js/kefu.js"></script>
</head>

<body>
    <!-- 顶部导航栏 -->
    <section>
        <div id="header">

            <div class="navbar">
                <div class="navbar-content">
                    <jsp:include page="yeah-top.jsp" />
                </div>
            </div>
            <div class="daohang">
                <a href="<%=basePath%>">首页</a>
                <span>></span>
                <a href="leaseitem">低价租赁</a>
                <span>></span>
                <a href="#">套餐一</a>
            </div>
        </div>
    </section>

    <section>
        <div class="rows">
            <p class="p1">租赁时长和数量</p>
            <p class="p2">限时优惠！所有套餐均送${item.zheko*10 }折优惠券（打折后最终价格将在结算页面显示）</p>
            <div class="row">
                <div class="row1">
                    <img src="${item.img }" style="width: 450px; height: 355px;">
                </div>
                <form action="xsqdd" method="post" onsubmit="return sub()">
                <div class="row2">
                	<input value="${item.rid }" id="rid" name="rid" type="hidden">
                    <p>品牌
                        <span>${item.brand }</span>
                    </p>
                    <p>cpu
                        <span>${item.cpu }</span>
                    </p>
                    <p>内存
                        <span>${item.neicuen }</span>
                    </p>
                    <p>显卡
                        <span>${item.xianka }</span>
                    </p>
                    <p>硬盘
                        <span>${item.yingpan }</span>
                    </p>
                    <div class="xianshiqi">
                    	<input type="hidden" id="xsq"  name="xsqid" value="${id }">
                        <ul>
                            <li class="teshu">显示器</li>
                            <c:forEach items="${list }" var="list">
                            	<li class="but1" onclick="xsq(${list.id })" >${list.name }</li>
                            </c:forEach>
                        </ul>
                    </div>
                    <div class="shichang">
                        <span>时长</span>
                        <input type="hidden" id="tim"  name="tim" value="1">
                        <input class="addBtn min" type="button" value="-" />
                        <input class="join-money" id="num" type="text" value="1" disabled="disabled">
                        <input class="addBtn add" type="button" value="+" />
                        <input id="r1" type="radio" value="0" name="num"> 天
                        </input>
                        <input id="r2" type="radio" value="1" name="num">月</input>
                    </div>
                    <div class="shuliang">
                        <span>数量</span>
                        <input type="hidden" id="tai"  name="tai" value="1">
                        <input class="addBtn1 min1" type="button"  value="-">
                        <input class="join-money1" id="genders" type="text" value="1" disabled="disabled">
                        <input class="addBtn1 add1" type="button"  value="+">
                        <span class="span1">（10台及以上免运费）</span>
                    </div>
                    <div class="zhuti">
                        <span>租赁主体</span> 
                        <input  type="radio" value="2" name="genders"> 个人
                        </input>
                        <input  type="radio" value="4" name="genders">公司</input>
                        <input type="radio" value="5" name="genders">学生</input>
                    </div>
                    <button id="bt1" onclick="tijiao()">立即租赁</button>
                    </form>
                </div>
            </div>
        </div>
    </section>

    <!-- 底部 -->
    <section>
        <jsp:include page="bottom.jsp" />
    </section>
</body>
<script type="text/javascript" src="<%=basePath%>static/layer/2.4/layer.js"></script>
<script type="text/javascript">

function xsq(id){
	$("#xsq").val(id);

};

function tijiao(){
	var num = $("input[name='num']:checked").val();
	var genders = $("input[name='genders']:checked").val();
	var xsq = $("#xsq").val();
	var nums = $("#num").val();
	var genderss = $("#genders").val();
	var rid = $("#rid").val();
	$("#tim").val(nums);
	$("#tai").val(genderss);
};

//判断是什么用户
function sub(){
	var fale = false;
	var num = $("input[name='num']:checked").val();
	var genders = $("input[name='genders']:checked").val();
	if(num == null || genders == null || num == "" || genders == ""){
		fale = false;
		layer.msg("不能为空",{icon:2});
	}else{
		$.ajaxSettings.async = false;
		$.post("pdu",{genders:genders},function(data){
			 if(data.fale){
				 fale = true;
			 }else{
				 fale = false;
				 layer.confirm(data.msg,{ btn: ["去认证","取消"] },function(index){
					layer.close(index);
				 	window.location.href = "user" ;
				 });
			 }
		},"json");
		$.ajaxSettings.async = true;
	}
	return fale;
}
</script>
</html>